package cn.zjitc.ptaLearn.ch07.ex03;

/**
 * @author Zixuan Xu
 * @date
 */
/*
输出样例:
    animal shout！
    wangwang……
    Dog is running
 */
public class Main {
    public static void main(String[] args) {
        Animal animal = new Animal();
//        animal.shout();  只要创建Animal对象,就会调用shout()方法,不用再自己调用一次
        Dog dog = new Dog();
        dog.shout();
        dog.run();
    }
}

class Animal {
    void shout() {
        System.out.println("animal shout！");
    }
}

class Dog extends Animal {
    void shout() {
        super.shout();
        System.out.println("wangwang……");
    }

    void run() {
        System.out.println("Dog is running");
    }
}